/*
 * @Descripttion:
 * @version:
 * @Author: wujq
 * @Date: 2023-06-26 17:42:15
 * @LastEditors: Andy
 * @LastEditTime: 2023-07-04 16:50:40
 */
import _ from 'lodash';

function setOem(res) {
  // oem 设置
  let oemId = _.get(res, 'data.data.result.oem_id');
  let titleIcon = window.document.getElementById('title-icon');
  if (oemId) {
    window.document.title = _.get(res, 'data.data.result.oem_title', '');
    let oemImgs = _.get(res, 'data.data.result.oem_imgs', []);
    if (_.includes(oemImgs, 'oem_favicon.ico')) {
      titleIcon.setAttribute('href', `/oem/${oemId}/oem_favicon.ico`);
    } else {
      titleIcon.setAttribute('href', '');
    }
  } else {
    window.document.title = 'ZoomEye Pro';
    titleIcon.setAttribute('href', '/favicon.ico');
  }
}

export default setOem;
